home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / OpenGL / extensions / man / gldetailtexfuncsgis.z / gldetailtexfuncsgis
Encoding:
Text File  |  1996-11-11  |  15.6 KB  |  263 lines

  1.  
  2.  
  3.  
  4. ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))        OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee        ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS - specify detail texture scaling function
  10.  
  11.  
  12. CCCC SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  13.      void ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS( GLenum _t_a_r_g_e_t,
  14.                                GLsizei _n,
  15.                                const GLfloat *_p_o_i_n_t_s )
  16.  
  17.  
  18. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  19.      _t_a_r_g_e_t  The target to which the scaling function will be applied. Must be
  20.              GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  21.  
  22.      _n       The number of scaling function samples in points.
  23.  
  24.      _p_o_i_n_t_s  An array of scaling function samples, each of which is an (_L_O_D,
  25.              _f_u_n_c_t_i_o_n-_v_a_l_u_e) pair.
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      The detail texture extension defines three additional texture
  29.      magnification filters.  These filters are selected by choosing one of the
  30.      values GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS, or
  31.      GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS for the current 2D texture's
  32.      GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMAAAAGGGG____FFFFIIIILLLLTTTTEEEERRRR.
  33.  
  34.      All three filters sample the level zero texture array exactly as it would
  35.      be sampled with filter mode GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.  All three also sample the level
  36.      zero texture array of a second texture, known as the detail texture, when
  37.      two conditions are met.  The detail texture corresponding to texture
  38.      GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS.  The conditions are:
  39.  
  40.           1.  The active texture must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  41.  
  42.           2.  The internal formats of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and
  43.               GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS must have been specified identically.
  44.  
  45.           3   The level 0 image of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD must have nonzero width and
  46.               height.
  47.  
  48.      If these conditions are not met, it is as though the magnification
  49.      texture filter was GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.  (Although querying the magnification
  50.      filter value will return the value as specified.)  If they are met, the
  51.      level zero array of the detail texture is also linearly sampled, using
  52.      the following arithmetic:
  53.  
  54.         n = log base 2 of the width of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
  55.         m = log base 2 of the height of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
  56.         N = log base 2 of the width of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
  57.         M = log base 2 of the height of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
  58.         L = GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS value of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))        OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee        ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  71.  
  72.  
  73.  
  74.         u = s * 2**(n+L)
  75.         v = t * 2**(m+L)
  76.  
  77.         i0 = floor(u - 1/2) mod 2**N
  78.         j0 = floor(v - 1/2) mod 2**M
  79.  
  80.         i1 = (i0 + 1) mod 2**N
  81.         j1 = (j0 + 1) mod 2**M
  82.  
  83.         A = frac(u - 1/2)
  84.         B = frac(v - 1/2)
  85.  
  86.         Tdetail = (1-A) * (1-B) * detail[i0,j0] +
  87.                      A  * (1-B) * detail[i1,j0] +
  88.                   (1-A) *    B  * detail[i0,j1] +
  89.                      A  *    B  * detail[i1,j1]
  90.      Thus _L, the value of the GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS parameter of
  91.      GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD, can be thought of as the number of levels that separate
  92.      the layer zero image of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and the image of
  93.      GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, which is replicated as necessary to fill the
  94.      appropriate number of texels.  For example, if _L is 2, the detail texture
  95.      image is replicated as necessary in x and y to form a single image whose
  96.      dimensions are four times larger than the level zero array of
  97.      GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  98.  
  99.      The texture value computed from the primary texture (_T_t_e_x_t_u_r_e) and the
  100.      value computed from the detail texture (_T_d_e_t_a_i_l) are combined in one of
  101.      two ways to compute the final texture value (_T).  The values of _T_t_e_x_t_u_r_e,
  102.      _T_d_e_t_a_i_l, and _T are treated as though they range from 0.0 through 1.0 in
  103.      these equations.
  104.  
  105.      If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____AAAADDDDDDDD, then
  106.  
  107.         T' = Ttexture + F(LOD) * (2*Tdetail-1)
  108.  
  109.         T = 0  if T' < 0;
  110.             T' if 0 <= T' <= 1;
  111.             1  if T' > 1.
  112.      where _F is a function of the level-of-detail parameter _L_O_D.  In effect,
  113.      the detail texture is scaled and biased so that its range is [-1,1].  The
  114.      resulting signed value is scaled by a function of _L_O_D, added to the base
  115.      texture, and clamped to [0,1].
  116.  
  117.      If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____MMMMOOOODDDDUUUULLLLAAAATTTTEEEE, then
  118.  
  119.         T' = Ttexture * (1 + F(LOD) * (2*Tdetail-1))
  120.  
  121.         T = 0  if T' < 0;
  122.             T' if 0 <= T' <= 1;
  123.  
  124.  
  125.  
  126.                                                                         PPPPaaaaggggeeee 2222
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))        OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee        ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  134.  
  135.  
  136.  
  137.             1  if T' > 1.
  138.      Here again the detail texture is scaled and biased so that its range is
  139.      [-1,1].  The resulting signed value is scaled by a function of _L_O_D and
  140.      biased by 1.  This result scales the base texture, which is then clamped
  141.      to [0,1].
  142.  
  143.      ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is used to specify the scaling function _F.  _t_a_r_g_e_t
  144.      must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.  _n specifies the number of pairs of values in
  145.      _p_o_i_n_t_s.  _p_o_i_n_t_s points to an array of pairs of floating point values.
  146.      The first value of each pair specifies a value of _L_O_D, and the second
  147.      value of each pair specifies the corresponding function value.  The order
  148.      in which the points are specified is not significant.  The _n value pairs
  149.      in _p_o_i_n_t_s completely specify the function, replacing any previous specif-
  150.      ication that may have existed.
  151.  
  152.      The function _F is evaluated by fitting a curve through the sample points
  153.      specified in _p_o_i_n_t_s.  This curve may be linear between adjacent points,
  154.      or it may be smoothed, but it will pass exactly through the points, lim-
  155.      ited only by the resolution of the implementation.  The value pair with
  156.      the lowest _L_O_D value specifies the function value _F for all values of _L_O_D
  157.      less than or equal to that pair's _L_O_D.  Likewise, the value pair with the
  158.      greatest _L_O_D value specifies the function value _F for all values of _L_O_D
  159.      greater than or equal to that pair's _L_O_D.
  160.  
  161.      Note that negative values of LOD correspond to magnification, and posi-
  162.      tive values correspond to minification.  Hence, an LOD of -4 corresponds
  163.      to a magnification by a factor of 2**4, or 16.  The default function
  164.      points are (0,0) and (-4,1).
  165.  
  166.      If the texture magnification filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, then both
  167.      the color and the alpha components of _T are computed as described in the
  168.      equations above.  If the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS, then all
  169.      components of _T other than alpha are computed as described above, and the
  170.      alpha component of _T is computed as if the texture magnification filter
  171.      were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.  Finally, if the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS,
  172.      the alpha component of _T is computed as described in the equations above,
  173.      and all other components of _T are computed as if the texture magnifica-
  174.      tion filter were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.
  175.  
  176. NNNNOOOOTTTTEEEESSSS
  177.      The detail texture itself is specified by calling ggggllllTTTTeeeexxxxIIIImmmmaaaaggggeeee2222DDDD with tar-
  178.      get set to GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, level set to 0, border set to 0,
  179.      and the other parameters specified to generate the desired image.
  180.  
  181. EEEERRRRRRRROOOORRRRSSSS
  182.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____EEEENNNNUUUUMMMM is generated if _t_a_r_g_e_t is not GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  183.  
  184.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____VVVVAAAALLLLUUUUEEEE is generated if _n is negative.
  185.  
  186.  
  187.  
  188.  
  189.                                                                         PPPPaaaaggggeeee 3333
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196. ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))        OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee        ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  197.  
  198.  
  199.  
  200.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is executed
  201.      between the execution of ggggllllBBBBeeeeggggiiiinnnn and the corresponding execution of
  202.      ggggllllEEEEnnnndddd.
  203.  
  204. AAAASSSSSSSSOOOOCCCCIIIIAAAATTTTEEEEDDDD GGGGEEEETTTTSSSS
  205.      ggggllllGGGGeeeettttTTTTeeeexxxxPPPPaaaarrrraaaammmmeeeetttteeeerrrr, ggggllllGGGGeeeettttDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS.
  206.  
  207.  
  208. MMMMAAAACCCCHHHHIIIINNNNEEEE DDDDEEEEPPPPEEEENNNNDDDDEEEENNNNCCCCIIIIEEEESSSS
  209.      Detail texturing is supported only on RealityEngine, RealityEngine2, and
  210.      VTX systems.  On these systems detail texturing may not be used when
  211.      rendering to pixmaps.
  212.  
  213.  
  214. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  215.      ggggllllTTTTeeeexxxxIIIImmmmaaaaggggeeee2222DDDD, ggggllllTTTTeeeexxxxPPPPaaaarrrraaaammmmeeeetttteeeerrrr, ggggllllTTTTeeeexxxxSSSSuuuubbbbIIIImmmmaaaaggggeeee2222DDDDEEEEXXXXTTTT.
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.                                                                         PPPPaaaaggggeeee 4444
  256.  
  257.  
  258.  
  259.